import {
	rsaEncrypt
} from '../../utils/rsa.js'
import lyRequest from '../index.js'

// 获取收藏题目列表
export const getCollectSimpleInfo = (pageNum) => {
	return lyRequest.get({
		url: `/personal/getCollectQuestionSimpleInfo/${pageNum}`
	})
}

// 获取错题列表
export const getMistakeSimpleInfo = (pageNum) => {
	return lyRequest.get({
		url: `/personal/getMistakeQuestionSimpleInfo/${pageNum}`
	})
}

// 根据题目id获取完整信息
export const getQuestionDetailById = (questionId) => {
	return lyRequest.get({
		url: `/personal/getQuestionDetailInfo/${questionId}`
	})
}

// 获取考试记录列表
export const getExamSimpleInfo = (pageNum) => {
	return lyRequest.get({
		url: `/personal/getQuestionExamSimpleInfoList/${pageNum}`
	})
}

// 获取考试记录详情
export const getExamDetailById = (examId) => {
	return lyRequest.get({
		url: `/personal/getExamCaseDetailInfo/${examId}`
	})
}

// 获取反馈列表
export const getFallbackSimpleInfo = (pageNum) => {
	return lyRequest.get({
		url: `/personal/getFeedbackRecordList/${pageNum}`
	})
}

// 获取反馈详细信息
export const getFallbackDetail = (feedbackRecordId) => {
	return lyRequest.get({
		url: `/personal/getFeedbackProgressInfo/${feedbackRecordId}`
	})
}

// 获取个人积分详情
export const getIntegralDetail = () => {
	return lyRequest.get({
		url: `/personal/getPersonalIntegralDetail/1`
	})
}

// 获取当前用户的信息
export const getPersonInfo = () => {
	return lyRequest.get({
		url: `/personal/getPersonalInfo`
	})
}

// 更新个人安全信息
export const reqUpdateSafeInfo = (encryptStr) => {
	return lyRequest.put({
		url: `/personal/updatePersonalInfo`,
		data: {
			encryptStr
		},
		isShowMessage: true
	})
}
// 更新个人普通信息
export const reqUpdateCommonInfo = (encryptStr) => {
	return lyRequest.put({
		url: `/personal`,
		data: {
			encryptStr
		},
		isShowMessage: true
	})
}

// 图片上传
export const reqUploadImg = (data) => {
	return lyRequest.post({
		url: '/file/uploadImage',
		data
	})
}

// 获取vip价格列表
export const getVipPriceList = () => {
	return lyRequest.get({
		url: '/personal/getVipPriceList'
	})
}

// 支付下单
export const reqOpenVip = (vipTypeId) => {
	return lyRequest.post({
		url: `/wx/pay/${vipTypeId}`
	})
}

// 根据订单号关闭订单
export const reqCloseOrderNo = (orderNo) => {
	return lyRequest.post({
		url: `/wx/closeOrder/${orderNo}`
	})
}

export const getTask = () => {
	return lyRequest.get({
		url: `/personal/getTodayTaskList`
	})
}
export const getActivity = () => {
	return lyRequest.get({
		url: `/activity/getList?current=1&size=10`
	})
}


export const reqQiandao = () => {
	return lyRequest.post({
		url: `/personal/signIn`
	})
}

export const getShangpin = () => {
	return lyRequest.get({
		url: `/personal/getShop/1`
	})
}

export const getDuihuanliebiao = () => {
	return lyRequest.get({
		url: `/personal/convertShopRecordList/1`
	})
}

export const reqDuihuan = (data) => {
	return lyRequest.post({
		url: `/personal/convertShop`,
		data: rsaEncrypt(data)
	})
}